-
Notifications
You must be signed in to change notification settings - Fork 7
fix: failed on pnpm #12
base: master
Are you sure you want to change the base?
Conversation
|
Never used |
in my project, {
"exports": {
"./package.json": "./package.json",
"./module": {
"import": "./es/module.js",
"require": "./cjs/module.js"
}
},
"dependencies": {
"dep-b": "version"
}
}
{
"exports": {
"./package.json": "./package.json",
"./moduleb": "./cjs/module.js",
},
}in file const foo = require('dep-b/moduleb')the key is pnpm has special node_module structure
But, I have not test on |
This is standard Node.js structure, just only not doing flatting dependencies. That scheme is fully supported by Node.js, in fact it's how originally worked by default until about npm v5.
Your |
I update // file.spect.ts
import bar from 'dep-a/module'
it('bar', () => {
// some test code
})/**
* @type {import('@jest/types').Config.InitialOptions}
*/
module.exports = {
roots: ['<rootDir>/src'],
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
resolver: '<rootDir>/resolver.js',
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleNameMapper: {
// If you defined paths in tsconfig.json
// you have to define them again here
// for jest doesn't respect tsconfig.json's paths
'@lib/(.*)': '<rootDir>/src/$1'
},
testEnvironment: 'jsdom',
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.test.json',
},
}
};
maybe is |
Why do you have a custom resolver instead of using this module? What's its content? |
|
|
it's looks like failed on
pnpm